//
//  GeometryReaderDemoView.swift
//  Counter
//
//  Created by huangguojian on 2021/11/26.
//

import SwiftUI

struct GeometryReaderDemoView: View {
    var body: some View {
        GeometryReader { proxy in
            VStack(spacing: 0) {
                Rectangle()
                    .fill(Color.red)
                    .frame(height: 0.3 * proxy.size.height)
                HStack(spacing: 0) {
                    Rectangle()
                        .fill(Color.green)
                        .frame(width: 0.4 * proxy.size.width)
                    VStack(spacing: 0) {
                        Rectangle()
                            .fill(Color.blue)
                            .frame(height: 0.4 * proxy.size.height)
                        Rectangle()
                            .fill(Color.yellow)
                            .frame(height: 0.3 * proxy.size.height)
                    }
                    .frame(width: 0.6 * proxy.size.width)
                }
            }
        }
    }
}

struct GeometryReaderDemoView__Previews: PreviewProvider {
    static var previews: some View {
        GeometryReaderDemoView()
        GeometryReaderDemoView()
.previewInterfaceOrientation(.landscapeLeft)
        GeometryReaderDemoView()
            .previewDevice("iPad mini (6th generation)")

    }
}
